export {};

// 定义一个接口-类型-约束

interface IPerson<Type> {
  name: string;
  code: () => Type;
  likes: () => Type[];
}

let person: IPerson<number> = {
  name: 'Jack',
  code: () => {
    return 123;
  },
  likes: () => [1, 2],
};

const strs = ['a', 'b', 'c'];
// 鼠标放在 forEach 上查看类型
strs.forEach((item) => console.log(item));

const nums = [1, 3, 5];
// 鼠标放在 forEach 上查看类型
nums.forEach((item) => console.log(item));
